﻿<UserControl x:Class="LayoutPlanning.Views.WorkStationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:LayoutPlanning.Views"
             xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
             xmlns:behaviours="clr-namespace:LayoutPlanning.Behaviours"
             xmlns:interactivity="clr-namespace:Mvvm.UI.Interactivity;assembly=Mvvm"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" DataContext="{Binding Main.SelectedStation,Source={StaticResource Locator}}">
    <Grid >
        <Button Command="{Binding ResetWorkTaskSelection}" HorizontalAlignment="Right" VerticalAlignment="Top" Content="Close" Width="50" />

        <Viewbox Margin="0,29,0,0">
            <Grid Margin="5">
                <ContentControl Content="{Binding ControlCopy.Element, Mode=OneTime}"/>
                
                <ItemsControl ItemsSource="{Binding  WorkPositions}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <Grid Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"   AllowDrop="True" Margin="0" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <UserControl RenderTransformOrigin="0.1,0.5" RenderTransform="{Binding Transform}" Width="{Binding ActualWidth, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource ParentWidthToWidth}, ConverterParameter=0.20}" Height="{Binding ActualWidth, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource ParentWidthToWidth}, ConverterParameter=0.05}" HorizontalAlignment="Left" VerticalAlignment="Top" Background="{Binding Background}">
                                <interactivity:Interaction.Behaviors>
                                    <behaviours:DragBehavior/>
                                    <!--<ei:TranslateZoomRotateBehavior  ConstrainToParentBounds="True" >
                                </ei:TranslateZoomRotateBehavior>-->
                                </interactivity:Interaction.Behaviors>
                                <Viewbox>
                                <Grid Width="20" Height="5">
                                    <Grid Background="White" HorizontalAlignment="Left" Margin="0,0" Width="5" Height="5" VerticalAlignment="Center" >
                                        <ed:Arc   ArcThickness="3" EndAngle="360" StartAngle="0" StrokeThickness="1"  >
                                        <ed:Arc.Stroke>
                                                <MultiBinding Converter="{StaticResource ObjectEqual}" >
                                                    <Binding />
                                                    <Binding Source="{StaticResource Locator}" Path="Main.SelectedStation.SelectedWorkPosition" />
                                                </MultiBinding>
                                                
                                        </ed:Arc.Stroke>
                                    </ed:Arc>
                                    </Grid>
                                    <ed:BlockArrow  Margin="5,0" ArrowBodySize="1"  ArrowheadAngle="45" Stroke="Black" StrokeThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="1" />
                                </Grid>
                                </Viewbox>
                            </UserControl>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
                <ItemsControl ItemsSource="{Binding  GripPositions}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <Grid  HorizontalAlignment="Stretch" VerticalAlignment="Stretch"   AllowDrop="True" x:Name="Grid"  Margin="0" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <UserControl RenderTransformOrigin="0.5,0.5" RenderTransform="{Binding Transform}" Width="{Binding ActualWidth, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource ParentWidthToWidth}, ConverterParameter=0.05}" Height="{Binding ActualWidth, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource ParentWidthToWidth}, ConverterParameter=0.05}" HorizontalAlignment="Left" VerticalAlignment="Top" Background="{Binding Background}">
                                <interactivity:Interaction.Behaviors>
                                    <behaviours:DragBehavior/>
                                    <!--<ei:TranslateZoomRotateBehavior  ConstrainToParentBounds="True" >
                                </ei:TranslateZoomRotateBehavior>-->
                                </interactivity:Interaction.Behaviors>
                                <Viewbox>
                                   
                                        <Grid Background="White" HorizontalAlignment="Left" Margin="0,0" Width="5" Height="5" VerticalAlignment="Center" >
                                            <ed:Arc   ArcThickness="3" EndAngle="360" StartAngle="0" StrokeThickness="1"  >
                                                <ed:Arc.Stroke>
                                                    <MultiBinding Converter="{StaticResource ObjectEqual}" >
                                                        <Binding />
                                                        <Binding Source="{StaticResource Locator}" Path="Main.SelectedStation.SelectedGripPosition" />
                                                    </MultiBinding>
                                                </ed:Arc.Stroke>
                                            </ed:Arc>
                                        </Grid>
                                    
                                </Viewbox>
                            </UserControl>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
                <Grid Width="5" Height="5" HorizontalAlignment="Left" VerticalAlignment="Top" RenderTransform="{Binding OrigoTransformation}">
                    <interactivity:Interaction.Behaviors>
                        <behaviours:DragBehavior />
                    </interactivity:Interaction.Behaviors>
                    <ed:LineArrow   Stroke="Black" BendAmount="0"  ArrowSize="0.4" StrokeThickness="0.3" HorizontalAlignment="Stretch"   VerticalAlignment="Top" Height="0.4">


                        <ed:LineArrow.RenderTransform>
                            <RotateTransform CenterX="0" CenterY="0" Angle="0" />
                        </ed:LineArrow.RenderTransform>
                    </ed:LineArrow>
                    <ed:LineArrow  StrokeDashOffset="0.5"  BendAmount="0"  Stroke="Black" ArrowSize="0.4" StrokeThickness="0.3" HorizontalAlignment="Left" VerticalAlignment="Stretch"  Width="0.4" />

                </Grid>
            </Grid>
        </Viewbox>
    </Grid>
</UserControl>































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































